<div class="clearfix">
    <div class="pull-left">
        <ol class="breadcrumb">
            <li><a ui-sref="/.index">首页</a></li>
            <li class="active">用户列表</li>
        </ol>
    </div>
    <div class="pull-right">
        <a ui-sref="/.user.add" class="btn btn-sm btn-primary">添加用户</a>
    </div>
</div>

<table id="dg"></table>
<script>

    $('#dg').datagrid({
        fitColumns: true,
        url: './data/user.json',
        singleSelect: true,
        columns: [[
            {field: 'name', title: '姓名', width: 100},
            {field: 'age', title: '年龄', width: 100},
            {field: 'sex', title: '性别', width: 100},
            {field: 'id', title: '操作', width: 100, formatter: function (v, r, i) {
                return '<a href="#/user/add/' + i + '" class="btn btn-default btn-xs">编辑</a>';
            }}
        ]]
    });

</script>